import api from '../index'
import type { ResponseData, PagingData, pageParam } from '../type'


export interface digitIntergralItem {
	id ?: Number
	orderCode ?: string //订单号
	fromUser ?: string //发起者
	fromAddress ?: string //发起者地址
	toUser ?: string //接收者
	toAddress ?: string //接收者地址
	hash ?: string //交易hash
	transNumber ?: string //交易数量
	transactionJson ?: string //交易json
	status ?: string //状态
}
// 上链记录
export const getTransactionDetailsList = (data : pageParam) =>
	api.get<ResponseData<digitIntergralItem[]>>('customer/api/contract/transaction/list', {
		data
	}
	)

// 上链详情
export const getTransactionDetails = (data : { id : string }) =>
	api.get<ResponseData<digitIntergralItem>>('customer/api/contract/transaction/get', {
		data
	}
	)

export interface digitIntergralConfig {
	bizid ?: Number //链ID
	contractName ?: string //合约名称
	contractAddress ?: string //合约地址
	contractCreate ?: string //合约创建者
	contractBrowser ?: string //区块链浏览器地址
	contractType ?: string //合约类型
	contractCode ?: string //合约代码
	nodeInformation ?: string //节点信息
	userAddress ?: string //用户地址
}

// 获取合约配置信息
export const getCustomerContractFig = (data : { strategy : string }) =>
	api.get<ResponseData<digitIntergralConfig>>('customer/api/contract/fig/get', {
		data
	}
	)